package com.woniu.auth.controller;

import com.woniu.auth.Vo.LoginVo;
import com.woniu.auth.service.LoginService;
import com.woniu.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class AuthController {
    @Resource
    private LoginService loginService;

    @RequestMapping("/login")
    public AjaxResult login(@RequestBody LoginVo loginVo){
        System.out.println(loginVo);
        String jwt = loginService.login(loginVo);
        return AjaxResult.success("ok",jwt);
    }
    @RequestMapping("/web/login")
    public AjaxResult webLogin(@RequestBody LoginVo loginVo){
        String jwt = loginService.weblogin(loginVo);
        return AjaxResult.success("ok",jwt);
    }
}
